using System;
using System.Collections.Generic;
using System.Text;

namespace Logging
{
    public abstract class Handler
    {

        private Level level;
        private Filter filter;
        private Formatter formatter;
        private string encoding;

        public Level Level
        {
            get { return level; }
            set { level = value; }
        }

        public Filter Filter
        {
            get { return filter; }
            set { filter = value; }
        }

        public Formatter Formatter
        {
            get { return formatter; }
            set { formatter = value; }
        }

        public string Encoding
        {
            get { return encoding; }
            set { encoding = value; }
        }

        public bool IsLoggable(LogRecord record)
        {
            return level.Value <= record.Level.Value && (filter == null || filter.IsLoggable(record));
        }

        public abstract void Close();
        public abstract void Flush();
        public abstract void Publish(LogRecord record);
    }
}
